home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(999 < fuel)
- {
- fuel = 999;
- }
- if(landed)
- {
- if(timer == 0)
- {
- _root.lv = vel - 20;
- }
- timer++;
- vel = 20;
- xvel = 20;
- if(20 < timer)
- {
- _root.scoreboard._visible = true;
- timer = 0;
- landed = false;
- }
- }
- else if(dead)
- {
- _alpha = _alpha - 10;
- if(0 >= _alpha)
- {
- if(1 < lives)
- {
- _alpha = 100;
- _X = _root.levels[_root.gamelevel - 1][0];
- _Y = _root.levels[_root.gamelevel - 1][1];
- fuel = _root.levels[_root.gamelevel - 1][2] * _root.grav * 20 + 100;
- lives--;
- _rotation = 0;
- xvel = 20;
- vel = 20;
- dead = false;
- invincible = 15;
- }
- else
- {
- _root.end = true;
- endtimer++;
- if(100 < endtimer)
- {
- _root.gotoAndStop("menu");
- _root.end = false;
- endtimer = 0;
- }
- }
- }
- }
- else
- {
- if(Key.isDown(221))
- {
- landed = true;
- _root.nextlevel();
- }
- if(Key.isDown(Key.SPACE) && 0 < fuel)
- {
- thrust = true;
- }
- else
- {
- thrust = false;
- }
- if(Key.isDown(Key.RIGHT))
- {
- _rotation = _rotation + 4;
- }
- else if(Key.isDown(Key.LEFT))
- {
- _rotation = _rotation - 4;
- }
- if(thrust)
- {
- fuel -= 1;
- vel -= 0.1;
- vel -= 0.1 * Math.abs(vel - 20);
- if(_rotation < 0)
- {
- xvel += _rotation / 900;
- xvel -= 0.1 * Math.abs(xvel - 20);
- }
- else if(0 < _rotation)
- {
- xvel += _rotation / 900;
- xvel += 0.1 * Math.abs(xvel - 20);
- }
- }
- else
- {
- vel += grav;
- vel += grav * Math.abs(vel - 20);
- }
- _Y = _Y + (vel - 20) / 2;
- _X = _X + (xvel - 20) / 3;
- if(800 + _width / 2 < _X)
- {
- _X = (- _width) / 2;
- }
- else if(_X < (- _width) / 2)
- {
- _X = 800 + _width / 2;
- }
- invincible--;
- }
- }
-